<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <style>

    </style>
</head>
<body>
<form class="layui-form layui-row" lay-filter="userinfo-form">
    <div class="layui-col-xs12 layui-col-md6">
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input name="name" disabled class="layui-input layui-disabled">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block user-sex">
                <input type="radio" name="sex" value="male" disabled title="男" checked="">
                <input type="radio" name="sex" value="female" disabled title="女">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">出生日期</label>
            <div class="layui-input-block">
                <input id="birthday" name="birthday" disabled class="layui-input layui-disabled">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号码</label>
            <div class="layui-input-block">
                <input name="mobile" disabled class="layui-input layui-disabled">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">公司</label>
            <div class="layui-input-block">
                <input name="orgName" disabled class="layui-input layui-disabled">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">部门</label>
            <div class="layui-input-block">
                <input name="deptName" disabled class="layui-input layui-disabled">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">角色</label>
            <div class="layui-input-block">
                <input name="roleName" disabled class="layui-input layui-disabled">
            </div>
        </div>


        <!--<div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="update-user-info">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>-->
    </div>
</form>

<script type="text/javascript">
	layui.use(['form', 'laydate', 'userServices'], function (form, laydate, userServices) {

		/**
		 * @author: ares
		 * @date: 2020/2/17 17:50
		 * @description: 渲染日期选择器
		 */
		laydate.render({
			elem: '#birthday'
		});
		renderInfo();
		/**
		 * @author: ares
		 * @date: 2020/2/17 17:54
		 * @description: 更新个人资料
		 */
		/*form.on("submit(update-user-info)", function (data) {
			var index = utils.layerLoadingMsg('提交中，请稍候');

			return false;
		})*/

        /**
         * @author: ares
         * @date: 2021/4/28 9:34
         * @description: 渲染表单信息
         */
        function renderInfo() {
            userServices.getCurrentUserInfo().then(function (res) {
            	var data = res.data;
	            form.val('userinfo-form', {
		            name: data.name,
		            sex: data.sex,
		            birthday: data.birthday,
		            mobile: data.mobile,
		            orgName: data.org.name,
		            deptName: data.dept.name,
		            roleName: data.role.name,
	            })
            })
        }
	})
</script>
</body>
</html>